package com.example;

import com.example.View.CustomerView;
import com.example.View.OrderView;
import com.example.View.ProductView;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {
        // 创建导航按钮
        Button productButton = new Button("产品管理");
        Button orderButton = new Button("订单管理");
        Button customerButton = new Button("客户管理");

        // 导航栏布局
        HBox navigation = new HBox(10);
        navigation.getChildren().addAll(productButton, orderButton, customerButton);

        // 创建视图
        CustomerView customerView = new CustomerView();
        ProductView productView = new ProductView();
        OrderView orderView = new OrderView();

        // 主布局
        VBox root = new VBox(20);
        root.getChildren().addAll(navigation, customerView.getView());

        // 创建场景
        Scene scene = new Scene(root, 800, 600);
        scene.getStylesheets().add(getClass().getResource("/com/example/styles.css").toExternalForm());

        // 设置舞台
        primaryStage.setTitle("仓库管理系统");
        primaryStage.setScene(scene);
        primaryStage.show();

        // 按钮事件处理
        customerButton.setOnAction(e -> {
            root.getChildren().set(1, customerView.getView());
        });

        productButton.setOnAction(e -> {
            root.getChildren().set(1, productView.getView());
        });

        orderButton.setOnAction(e -> {
            root.getChildren().set(1, orderView.getView());
        });
    }

    public static void main(String[] args) {
        launch(args);
    }
}